"""
Test that image has not changed type when:
1. Read in as ITK from disk as Float
2. Converted from ITK -> VTK
"""

import connect2
import vtk
import itk
from time import time
import ImageCompare

inputFilename='C:/Lib/JointTrack/branches/bryan/Images/itktestimage.png'
outputFilename = 'C:/Lib/JointTrack/branches/bryan/Images/itkvtkoutput.png'

ext=inputFilename[inputFilename.find('.'):]
vtk2itk = connect2.vtk2itk()
itk2vtk = connect2.itk2vtk()

input_image = itk.Image.F2.New()

reader = itk.ImageFileReader[input_image].New()

reader.SetFileName(inputFilename)
reader.Update()


# convert from itk to vtk
itk2vtk.SetInput(reader.GetOutput())
vtkImg = itk2vtk.GetOutput()
vtkImg.Update()
vtkPixelType = vtkImg.GetScalarTypeAsString()

#Compare the vtk pixel type to input pixel type (float)
#Test for positive match
assert vtkPixelType == "float"

if vtkPixelType == "float":
    print "Test Success!"
else:
    print "Test Failure!"
    